<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/commons/taglib.jsp"%>
<%@ attribute name="id" type="java.lang.String" required="true" description="编号"%>
<%@ attribute name="locationName" type="java.lang.String" required="true" description="输入域经纬度name"%>
<%@ attribute name="locationValue" type="java.lang.String" required="true" description="输入域经纬度value"%>
<%@ attribute name="addressName" type="java.lang.String" required="true" description="输入域地址name"%>
<%@ attribute name="addressValue" type="java.lang.String" required="true" description="输入域地址value"%>
<%@ attribute name="title" type="java.lang.String" required="true" description="标题"%>
<%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="cssStyle" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="hideBtn" type="java.lang.Boolean" required="false" description="是否显示按钮"%>
<%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择，如果限制，设置为disabled"%>
<%@ attribute name="dataMsgRequired" type="java.lang.String" required="false" description=""%>


<div class="input-group">
	<input id="${id}Location" name="${locationName}" class="${cssClass}" type="hidden" value="${locationValue}"/>
	<input id="${id}Address" name="${addressName}" ${allowInput?'':'readonly="readonly"'} type="text" value="${addressValue}"   class="form-control ${cssClass}" style="${cssStyle}"/>
	<span class="input-group-btn">
		<a id="${id}Button" href="javascript:" class="btn btn-primary btn-sm ${disabled} ${hideBtn ? 'hide' : ''}"  ><i class="icon-search"></i></a>
	</span>
</div>



<script type="text/javascript">
	$("#${id}Button, #${id}Name").click(function(){
		// 是否限制选择，如果限制，设置为disabled
		if ($("#${id}Button").hasClass("disabled")){
			return true;
		}
		window.top.layer.open({
			title:'${title}',
			type: 2,
			  content: "${ctx}/tag/map?id=${id }&locationValue=${locationValue }&addressValue=${addressValue }",
			  scrollbar: false,
			  area: ['600px','400px'],
			  maxmin: true,
			  resize:true,
			  btn: ['确定', '关闭'],
			  yes: function(index, layero){
			    //do something
				var iframeWin = window.top.frames[layero.find('iframe')[0]['name']];
			   // var iframeWin = window.frames[0].frames['right-iframe'];
			  $("#${id}Location").val(iframeWin.$("#${id}Location").val());
			  $("#${id}Address").val(iframeWin.$("#${id}Address").val());
			   
				window.top.layer.close(index); //如果设定了yes回调，需进行手工关闭
			  },
			  btn2: function(index, layero){
				  window.top.layer.close(index);
			}
			});
	});
</script>